package players;

import java.util.InputMismatchException;
import java.util.Scanner;
import cards.Deck;

public abstract class userInput {

	private static Scanner i = new Scanner(System.in);
	
	
	//gets the bid from a non computer player
	public static int bidInput(int lowRange, int hiRange){
		
		boolean inputOK = false;
		int myBid = 0;
		
		while (!inputOK){
			System.out.print("Please Enter Your Bid: ");
			
			try{
				myBid = i.nextInt();
				//check for correct input
				
				if((myBid >= lowRange && myBid <= hiRange) || myBid == 0){
					inputOK = true;
				} else {
					System.out.println("Bid Out of Range. Please Try Again...");
				}
			} catch (InputMismatchException x) {
				System.out.println("Input Error: " + x + ". Please Try Again...");
			}
		}
		
		return myBid;
		
	}
	
	public static int whatCard(Deck hand){
		
		boolean inputOK = false;
		int whatCard = 0;
		
		while (!inputOK){
			
			System.out.print("> ");
			
			try{
				whatCard = i.nextInt();
			
				if(whatCard >=0 && whatCard <= hand.length()){
					inputOK = true;
				} else {
					System.out.println("Invalid Entry, please try again");
				}
			} catch (InputMismatchException x) {
				System.out.println("Input Error: " + x + " Please Try Again...");
			}
			
		}
	
		return whatCard;	//index of card to be played
		
	}
	
	
}